1 package mobisnap.mobile_trx;
2
3 import java.sql.*;
4
5 /***
6 * Used to represent variables and constants internally
7 */
8 public class MSQLTDate extends MSQLTVariable
9 {
10 public MSQLTDate( boolean constant, boolean notnull) {
11 super( constant, notnull);
12 }
13
14 /***
15 * Sets the value of the given variable
16 */
17 public void setValue( Object obj) throws Exception {
18 if( constant && value != null)
19 throw new mobisnap.MobisnapException( "Assigning value to constant");
20 if( obj instanceof java.sql.Date)
21 value = obj;
22 else if( obj instanceof SQLNull && ! notnull)
23 value = obj;
24 else if( obj instanceof String && MSQLTypeUtil.mayBeDate( obj))
25 value = MSQLTypeUtil.string2Date((String)obj);
26 else if( obj instanceof java.sql.Timestamp)
27 value = new java.sql.Date( ((java.sql.Timestamp)obj).getTime());
28 else
29 throw new mobisnap.MobisnapException( "Invalid assgnment to date : " + obj.getClass().getName() + " : " + obj.toString());
30 }
31 }
This page was automatically generated by Maven